<template>
  <div class="order-module">
    <div class="module-header">
      <h3 class="module-title">我的订单</h3>
      <div class="view-all">查看全部 <i class="fa fa-angle-right"></i></div>
    </div>

    <div class="order-grid">
      <div class="order-item" @click="navigateTo('/orders')">
        <div class="icon-wrapper">
          <i class="fa fa-file-text-o"></i>
        </div>
        <div class="label">全部</div>
      </div>

      <div class="order-item" @click="navigateTo('/orders?status=pending')">
        <div class="icon-wrapper">
          <i class="fa fa-hourglass-half"></i>
        </div>
        <div class="label">待收货/使用</div>
      </div>

      <div class="order-item" @click="navigateTo('/orders?status=review')">
        <div class="icon-wrapper">
          <i class="fa fa-comment-o"></i>
          <span class="badge">3</span>
        </div>
        <div class="label">待评价</div>
      </div>

      <div class="order-item" @click="navigateTo('/orders?status=refund')">
        <div class="icon-wrapper">
          <i class="fa fa-money"></i>
        </div>
        <div class="label">退款</div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router';

const router = useRouter();

const navigateTo = (path) => {
  router.push(path);
};
</script>

<style scoped>
.order-module {
  background-color: white;
  margin: 15px;
  border-radius: 8px;
  padding: 15px;
}

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.module-title {
  font-size: 16px;
  font-weight: bold;
  margin: 0;
}

.view-all {
  font-size: 12px;
  color: #999;
}

.order-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.order-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.icon-wrapper {
  position: relative;
  width: 28px;
  height: 28px;
  margin-bottom: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.icon-wrapper i {
  font-size: 20px;
  color: #333;
}

.badge {
  position: absolute;
  top: -5px;
  right: -8px;
  background-color: #ff5252;
  color: white;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  padding: 0 4px;
}

.label {
  font-size: 12px;
  color: #666;
}
</style> 